<template>
    <section>
        <div :style="{height:height,width:width}" id="editor" class="text wangEditorContent"></div>
    </section>
</template>

<script>
import E from 'wangeditor'

export default {
    props: {
        content: "",
        url:{
            default:String
        },
        height:{
            default:'800px'
        },
        width:{
            default:'800px'
        }
    },
    data(){
        return {
            editor: ''
        }
    },
    mounted() {
        this.createEditor()
    },
    methods: {
        createEditor() {
            //wangEditor配置
            this.editor = new E('#editor')
            this.editor.customConfig.menuFixed = false
            this.editor.customConfig.uploadImgServer = this.url
            this.editor.customConfig.uploadFileName = 'file'
            this.editor.create();
            // 初始化编辑器的内容
            this.editor.txt.html('');
        },
        getContent() {
            return this.editor.txt.html()
        },
        setContent(html) {
            this.editor.txt.html(html)
        }
    }
}
</script>
<style>
#text-elem4657101923216891{
    height: 1600px;
}
</style>
